<?xml version="1.0" encoding="utf-8" ?>
<Recipe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
Name="ListDefinition"
xmlns="http://schemas.microsoft.com/pag/gax-core"
Bound="false">
  <xi:include href="../../../TypeAlias.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
  <Caption>List Definition</Caption>
  <Description>Adds a list definition based on a local installed list definition</Description>
  <HostData>
    <Icon File="Help/Icons/icon_ListAndDoc.ico" />
    <CommandBar Menu="SPSFProjectListAndDoc"/>
    <CommandBar Menu="SPSFFolderListAndDoc"/>
    <spsf:MetaData
      Visible="true"
      BindingType="ElementManifestReference"
      BindingTypeTemplate="ElementManifestReferenceTemplate"
      TestType="BaseSiteFeatureRecipeRunner"
      Enabled="true"
      CreateVSTemplate="true"
      FeatureScopes="Web;Site"
      Category="ListAndDoc" xmlns:spsf="http://www.spalmblogger.de">
      <spsf:Authors>
        <spsf:Author>Torsten Mandelkow</spsf:Author>
      </spsf:Authors>
      <spsf:VersionHistory>
        <spsf:VersionHistoryEntry>1.0 Initial Recipe</spsf:VersionHistoryEntry>
      </spsf:VersionHistory>
      <spsf:WebPageContent>
        <![CDATA[]]>
      </spsf:WebPageContent>
    </spsf:MetaData>
  </HostData>
  <Arguments>

    <Argument Name="AllowedScopes" Type="System.String">
      <ValueProvider Type="Evaluator" Expression="Web" />
    </Argument>

    <xi:include href="../../BaseArguments.include" parse="xml" xpointer="xmlns(p=http://schemas.microsoft.com/pag/gax-core) xpointer(/p:Arguments/*)" xmlns:xi="http://www.w3.org/2001/XInclude" />

    <xi:include href="../BaseFeatureArguments.include" parse="xml" xpointer="xmlns(p=http://schemas.microsoft.com/pag/gax-core) xpointer(/p:Arguments/*)" xmlns:xi="http://www.w3.org/2001/XInclude" />

    <Argument Name="ElementsCategory">
      <ValueProvider Type="Evaluator" Expression="ListDefinitions" />
    </Argument>

    <Argument Name="ResourceKeyPrefix" Required="true">
      <!-- provides the unique key with removed special chars -->
      <ValueProvider Stage="OnBeforeActions" RecipeArgument="ListTemplateName" Type="ConvertedStringProvider" />
    </Argument>

    <Argument Name="ListTemplateBaseTemplate" Type="NameValueItem" Required="true" >
      <ValueProvider Type="DefaultNameValueItemProvider" Name="Custom List" Value="100" />
    </Argument>
    <Argument Name="ListTemplateName" Required="true">
      <Converter Type="NamespaceStringConverter" />
      <ValueProvider Type="VisualStudioCreateItemName" DefaultValue="ListDefinition1" />
    </Argument>
    <Argument Name="ListTemplateDisplayName" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(ListTemplateName)" />
    </Argument>
    <Argument Name="ListTemplateDescription" >
      <ValueProvider Type="Evaluator" Expression="Template to create a $(ListTemplateName)" />
    </Argument>
    <Argument Name="ListTemplateType" >
      <ValueProvider Type="Evaluator" Expression="10000" />
    </Argument>

    <Argument Name="ListTemplateBaseType" Type="NameValueItem" >
      <Converter Type="ListTemplateBaseTypeConverter" />
      <ValueProvider Type="DefaultNameValueItemProvider" Name="Custom List" Value="0" />
    </Argument>

    <Argument Name="ListTemplateCategory" >
      <Converter Type="SPALM.SharePointSoftwareFactory.Library.Converters.ListTemplateCategoryConverter, SPALM.SharePointSoftwareFactory.Library" />
      <ValueProvider Type="Evaluator" Expression="Custom Lists" />
    </Argument>
    <Argument Name="ListTemplateDefault" Type="System.Boolean">
      <ValueProvider Type="Evaluator" Expression="false" />
    </Argument>
    <Argument Name="ListTemplateOnQuickLaunch" Type="System.Boolean">
      <ValueProvider Type="Evaluator" Expression="false" />
    </Argument>
    <Argument Name="ListTemplateDisableAttachments" Type="System.Boolean">
      <ValueProvider Type="Evaluator" Expression="false" />
    </Argument>
    <Argument Name="ListTemplateDisallowContentTypes" Type="System.Boolean">
      <ValueProvider Type="Evaluator" Expression="false" />
    </Argument>
    <Argument Name="ListTemplateVersioningEnabled" Type="System.Boolean">
      <ValueProvider Type="Evaluator" Expression="false" />
    </Argument>
    <Argument Name="ListTemplateFolderCreation" Type="System.Boolean">
      <ValueProvider Type="Evaluator" Expression="false" />
    </Argument>
    <Argument Name="ListTemplateEnableModeration" Type="System.Boolean">
      <ValueProvider Type="Evaluator" Expression="false" />
    </Argument>
    <Argument Name="ListTemplateSecurityBitsRead" >
      <Converter Type="SPALM.SharePointSoftwareFactory.Library.Converters.ListTemplateSecurityBitsConverterRead, SPALM.SharePointSoftwareFactory.Library" />
      <ValueProvider Type="Evaluator" Expression="1 - Users can read all items" />
    </Argument>
    <Argument Name="ListTemplateSecurityBitsEdit" >
      <Converter Type="SPALM.SharePointSoftwareFactory.Library.Converters.ListTemplateSecurityBitsConverterEdit, SPALM.SharePointSoftwareFactory.Library" />
      <ValueProvider Type="Evaluator" Expression="1 - Users can edit all items" />
    </Argument>
    <Argument Name="ListTemplateSequence" Type="System.Int32">
      <ValueProvider Type="Evaluator" Expression="1000" />
    </Argument>
    <Argument Name="ListTemplateImage" >
      <ValueProvider Stage="OnBeforeActions" Type="Evaluator" Expression="/_layouts/images/$(LayoutsFolder)/ListIcon_$(ListTemplateName).gif" />
    </Argument>
    <Argument Name="ListTemplateHidden" Type="System.Boolean">
      <ValueProvider Type="Evaluator" Expression="false" />
    </Argument>
    <Argument Name="ListTemplateHiddenList" Type="System.Boolean">
      <ValueProvider Type="Evaluator" Expression="false" />
    </Argument>

    <Argument Name="ListTemplateIconFileName">
      <ValueProvider Stage="OnBeforeActions" Type="Evaluator" Expression="ListIcon_$(ListTemplateName).gif" />
    </Argument>

    <Argument Name="ListTemplateContentTypes" Required="false" Type="NameValueItemArray" >
      <ValueProvider Type="DefaultNameValueCollectionProvider"  />
    </Argument>

  </Arguments>
  <GatheringServiceData>
    <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">
      <Pages>
        <Page Type="SPALM.SharePointSoftwareFactory.Library.CustomWizardPages.FeatureSelectionPage, SPALM.SharePointSoftwareFactory.Library" />
        <Page Height="350">
          <Title>List Template Settings</Title>
          <Fields>
            <Field PanelType="SPALM.SharePointSoftwareFactory.Library.NameValueItemPanel, SPALM.SharePointSoftwareFactory.Library" ValueName="ListTemplateBaseTemplate" Label="Base Template" >
              <Help>Required Integer. Specifies the base type, or default schema, for lists created from the definition.</Help>
              <Editor Type="SPALM.SharePointSoftwareFactory.Library.LocalListTemplatesEditor, SPALM.SharePointSoftwareFactory.Library" />
            </Field>
            <Field ValueName="ListTemplateName" Label="Name">
              <Help>Required Text. Specifies the internal name of the list definition. No spaces or special characters can be used. This name is also used to find the folder that contains the Schema.xml file that defines the schema in use.</Help>
            </Field>
            <Field ValueName="ListTemplateDisplayName" Label="DisplayName">
              <Help>Required Text. Specifies the display name of the list definition.</Help>
            </Field>
            <Field ValueName="ListTemplateDescription" Label="Description">
              <Help>Optional Text. Provides a description of the list definition.</Help>
            </Field>
            <Field ValueName="ListTemplateCategory" Label="Category">
              <Help>Optional Text. Specifies the category with which to associate lists created through the list definition.</Help>
            </Field>
            <Field ValueName="ListTemplateSequence" Label="Sequence">
              <Help>Optional Integer. Specifies the ordering priority to use for the list template on the Create page. If Sequence is not set, the template appears last in arbitrary order with any other templates that also lack a Sequence value. Two templates that specify the same sequence are sorted together in an arbitrary order.</Help>
            </Field>
          </Fields>
        </Page>
        <Page Height="350">
          <Title>Advanced Settings</Title>
          <Fields>
            <Field ValueName="ListTemplateType" Label="Type">
              <Help>Optional Integer. Provides a unique identifier for the template. This identifier must be unique within the feature, but need not be unique across all feature definitions or site definitions. </Help>
            </Field>
            <Field PanelType="SPALM.SharePointSoftwareFactory.Library.NameValueDropDownPanel, SPALM.SharePointSoftwareFactory.Library" ValueName="ListTemplateBaseType" Label="Base Type" >
              <Help>Required Integer. Specifies the base type, or default schema, for lists created from the definition.</Help>
            </Field>
            <Field ValueName="ListTemplateContentTypes" PanelType="SPALM.SharePointSoftwareFactory.Library.NameValueListPanel, SPALM.SharePointSoftwareFactory.Library" Label="Additional Content Types" >
              <Help>Optional Content Types.</Help>
              <Editor Type="SPALM.SharePointSoftwareFactory.Library.ContentTypeEditor, SPALM.SharePointSoftwareFactory.Library" />
            </Field>
          </Fields>
        </Page>
        <Page Height="350">
          <Title>Options</Title>
          <Fields>
            <Field ValueName="ListTemplateDefault" Label="Default in new sites">
              <Help>Optional Boolean. TRUE to specify that new SharePoint sites will include this list.</Help>
            </Field>
            <Field ValueName="ListTemplateOnQuickLaunch" Label="OnQuickLaunch">
              <Help>Optional Boolean. TRUE to display lists created from the list definition on the QuickLaunch bar.</Help>
            </Field>
            <Field ValueName="ListTemplateDisableAttachments" Label="DisableAttachments">
              <Help>Optional Boolean. TRUE to specify that users can attach files to items in lists created through the template; otherwise, FALSE.</Help>
            </Field>
            <Field ValueName="ListTemplateDisallowContentTypes" Label="DisallowContentTypes">
              <Help>Optional Boolean. TRUE to specify that content types can be managed on lists created through the template; otherwise, FALSE.</Help>
            </Field>
            <Field ValueName="ListTemplateVersioningEnabled" Label="VersioningEnabled">
              <Help>Optional Boolean. TRUE to specify that versioning is enabled by default in lists created through the template; otherwise, FALSE.</Help>
            </Field>
            <Field ValueName="ListTemplateFolderCreation" Label="FolderCreation">
              <Help>Optional Boolean. TRUE to enable folder creation within the list and to specify that the New Folder command appears on the New menu in list views; otherwise, FALSE.</Help>
            </Field>
            <Field ValueName="ListTemplateEnableModeration" Label="EnableModeration">
              <Help>Optional Boolean. TRUE to specify that content approval is enabled by default in lists created through the template; otherwise, FALSE.</Help>
            </Field>
            <Field ValueName="ListTemplateHidden" Label="Hidden">
              <Help>Optional Boolean. TRUE to specify that the list definition is not available on the Create page for creating lists.</Help>
            </Field>
            <Field ValueName="ListTemplateHiddenList" Label="HiddenList">
              <Help>Optional Boolean. TRUE to specify that a list created from the list definition is hidden.</Help>
            </Field>
          </Fields>
        </Page>
        <Page Height="350">
          <Title>Advanced</Title>
          <Fields>
            <Field ValueName="ListTemplateSecurityBitsRead" Label="Security Read">
              <Help>Optional Text. Defines the item-level permissions in the list for users with sufficient permission to read or edit list items. The SecurityBits attribute contains a 2-digit string. The first digit in the string controls the read access; the second digit in the string controls the edit access.</Help>
            </Field>
            <Field ValueName="ListTemplateSecurityBitsEdit" Label="Security Edit" >
              <Help>Optional Text. Defines the item-level permissions in the list for users with sufficient permission to read or edit list items. The SecurityBits attribute contains a 2-digit string. The first digit in the string controls the read access; the second digit in the string controls the edit access.</Help>
            </Field>
          </Fields>
        </Page>
      </Pages>
    </Wizard>
  </GatheringServiceData>
  <Actions CoordinatorServiceType="ConditionalCoordinator">

    <xi:include href="../../BaseStartingActions.include" parse="xml" xpointer="xmlns(p=http://schemas.microsoft.com/pag/gax-core) xpointer(/p:Actions/*)" xmlns:xi="http://www.w3.org/2001/XInclude" />

    <xi:include href="../BaseFeatureActions.include" parse="xml" xpointer="xmlns(p=http://schemas.microsoft.com/pag/gax-core) xpointer(/p:Actions/*)" xmlns:xi="http://www.w3.org/2001/XInclude" />

    <!-- elements.xml-->
    <Action
      Name="CreateElementsXml"
      Type="AddElementsDefinitionAction"
      ParentFeatureName="$(ParentFeatureName)"
      ElementsName="$(ListTemplateName)"
      ElementsCategory="$(ElementsCategory)"
      TemplateFileName="Text\ListTemplate\elements.xml.t4"
      SPDataTemplate="Text\ListTemplate\SharePointProjectItem.spdata.t4"
      Open="true">
      <Output Name="CreatedElementFolder" />
      <Output Name="CreatedElementFile" />
    </Action>

    <!-- Resources -->
    <Action
      Condition="$(AutoCreateResxFiles)"
      Name="AddResources"
      Type="AddTemlateToResourcesFileAction"
      TemplateFileName="Text\ListTemplate\Resources.resx.t4"
      FeatureResources="True">
      <Input Name="FeatureName" RecipeArgument="ParentFeatureName" />
    </Action>

    <!-- import existing definition -->
    <Action
      Name="ImportDefinition"
      Type="AddLocalListDefinition"
      DeploymentType="ElementFile"
      DeploymentPath="$(ListTemplateName)" >
      <Input Name="BaseListTemplate" RecipeArgument="ListTemplateBaseTemplate" />
      <Input Name="ContentTypes" RecipeArgument="ListTemplateContentTypes" />
      <Input Name="ParentProjectFolder" ActionOutput="CreateElementsXml.CreatedElementFolder" />
    </Action>

    <!-- add list icon -->
    <Action
      Name="AddListIcon"
      Type="AddFileToItemAction"
      DeploymentType="TemplateFile"
      DeploymentPath="Images\$(SafeAppName)"
      SourceFileName="Text/ListTemplate/ListIcon.gif"
      TargetFileName="$(ListTemplateIconFileName)">
      <Input Name="ExcludeCondition" RecipeArgument="ProjectIsSandboxedSolution" />
    </Action>

    <xi:include href="../../BaseFinalActions.include" parse="xml" xpointer="xmlns(p=http://schemas.microsoft.com/pag/gax-core) xpointer(/p:Actions/*)" xmlns:xi="http://www.w3.org/2001/XInclude" />

  </Actions>
</Recipe>